// 用户API
const install = (Vue, vm) => {
	// 登录
	//
	let phoneLogin = (data) => vm.$zx.post("/auth/login", data);
	//获取消息
	let getMessages = ({
			page,
			status
		}) =>
		vm.$zx.get(
			`/messagePush/getMessageByUid?pageNo=${page}&pageSize=10` +
			(status !== null ? `&status=${status}` : "")
		);
	// 修改消息状态
	let updateMessageStatus = (id, status) =>
		vm.$zx.get(`/messagePush/updateStatus/${id}/${status}`);
	// 获取用户信息
	let getUserInfo = () => vm.$zx.post("/user/userInfo");

	// 修改头像
	let updateAvatar = (file) => vm.$zx.post("/user/update/avatar", file);
	// 修改密码
	let updatePassword = (data) => vm.$zx.post("/user/update/password", data);

	let sendVerifyCodeSms = (data) => vm.$zx.post("/common/sendVerifyCodeSms", data);
	// 修改密码
	let forgetPassword = (data) => vm.$zx.post("/user/forgetPassword", data);
	// 首页数据
	let getHomeData = () => vm.$zx.post("/api/myInfo/homeData");

	let getAllChannelLists = () => vm.$zx.get("/api/acqChannel/listAllChannel");
	let switchingChannel = (channelNo) => vm.$zx.post("/api/myInfo/switchingChannel", channelNo);
	//业绩
	let getBenefitDetailData = () => vm.$zx.post("/api/dataStat/performanceOverview")
	let accountStatistics = () => vm.$zx.post("/api/myInfo/accountStatistics")
	let merchantCountList = (data) => vm.$zx.post(`/api/activityCount/merchantCountList`, data);
	let incomeStat = () => vm.$zx.post(`/api/dataStat/incomeStat`);
	let merchantInfoQuery = (pageNo, pageSize, data) => vm.$zx.post(
		`/api/merchantInfo/queryPage/${pageNo}/${pageSize}`, data);
	let agentList = (pageNo, pageSize, data) => vm.$zx.post(
		`/api/agent/list/${pageNo}/${pageSize}`, data);
	let agentTopData = (pageNo, pageSize, data) => vm.$zx.post(
		`/api/dataStat/agentTopData/${pageNo}/${pageSize}`, data);

	let listMyAccount = () => vm.$zx.post(
		`/api/myInfo/listMyAccount`);

	let querySetter = () => vm.$zx.get(
		`/api/myInfo/querySetter`);

	let updateSetter = (data) => vm.$zx.post(
		`/api/myInfo/updateSetter`, data);

	let myInfoUpdatePassword = (data) => vm.$zx.post(
		`/api/myInfo/updatePassword`, data);

	let saveAgent = (data) => vm.$zx.post(
		`/api/agent/saveAgent`, data);
	let agentAllAchievement = (agentNo) => vm.$zx.post(
		`/api/agent/allAchievement/${agentNo}`);
	let agentAllAchievement2 = (agentNo, data) => vm.$zx.post(
		`/api/agent/achievement2/${agentNo}`, data);

	let getAgentDetail = (agentNo) => vm.$zx.get(
		`/api/agent/detail/${agentNo}`);

	let queryMyInfo = (agentNo) => vm.$zx.get(
		`/api/myInfo/queryMyInfo`);
	let queryMerRateChangeApply = (merchantNo) => vm.$zx.post(
		`/api/merchantRate/queryMerRateChangeApply/${merchantNo}`);
	let queryAgentHasCostConfig = (agentNo) => vm.$zx.get(
		`/api/agent/queryAgentHasCostConfig/${agentNo}`);
	let profitSwitch = (agentNo, status) => vm.$zx.post(
		`/api/agent/profitSwitch/${agentNo}/${status}`);
	let settleProfitSwitch = (agentNo, status) => vm.$zx.post(
		`/api/agent/settleProfitSwitch/${agentNo}/${status}`);
	let cashbackSwitch = (agentNo, status) => vm.$zx.post(
		`/api/agent/cashbackSwitch/${agentNo}/${status}`);
	let updateAgentCashBack = (agentNo, data) => vm.$zx.post(
		`/api/agent/updateAgentCashBack/${agentNo}`, data);
	let updateAgentCost = (agentNo, data) => vm.$zx.post(
		`/api/agent/updateAgentCost/${agentNo}`, data);
	let withdrawal = (data) => vm.$zx.post(
		`/api/extractionOrder/withdrawal`, data);
	vm.$zx.user_api = {
		phoneLogin,
		getMessages,
		updateMessageStatus,
		getUserInfo,
		updateAvatar,
		updatePassword,
		sendVerifyCodeSms,
		forgetPassword,
		getHomeData,
		getAllChannelLists,
		switchingChannel,
		getBenefitDetailData,
		accountStatistics,
		merchantCountList,
		incomeStat,
		merchantInfoQuery,
		agentList,
		agentTopData,
		listMyAccount,
		querySetter,
		updateSetter,
		myInfoUpdatePassword,
		saveAgent,
		agentAllAchievement,
		agentAllAchievement2,
		getAgentDetail,
		queryMyInfo,
		queryMerRateChangeApply,
		queryAgentHasCostConfig,
		profitSwitch,
		settleProfitSwitch,
		cashbackSwitch,
		updateAgentCashBack,
		updateAgentCost,
		withdrawal
	};
};

export default {
	install,
};